package org.jeecg.modules.talent.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.jeecg.modules.talent.entity.Talent;
import org.jeecg.modules.talent.mapper.TalentMapper;
import org.jeecg.modules.talent.service.ITalentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.*;
import java.util.function.Function;


@Service
public class TalentServiceImpl implements ITalentService {
    @Autowired
    private TalentMapper talentMapper;
    @Override
    public List<Talent> findAll(Talent talent) {
        return talentMapper.findAll(talent);
    }

    @Override
    public void insertTalent(Talent talent) {
        talentMapper.insertTalent(talent);
    }

    @Override
    public void deleteTalentById(int  id) {
        talentMapper.deleteTalentById(id);
    }

    @Override
    public Talent selectById(int id) {
        return talentMapper.selectById(id);
    }

    @Override
    public void updateTalent(Talent talent) {
        talentMapper.updateTalent(talent);
    }

    @Override
    public void removeByIds(List<String> asList) {
        for (int i=0;i<asList.size();i++){
            talentMapper.deleteTalentById(Integer.parseInt(asList.get(i)));
        }
    }




    @Override
    public boolean save(Talent entity) {
        return false;
    }

    @Override
    public boolean saveBatch(Collection<Talent> entityList, int batchSize) {
        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        Iterator<Talent> talentIterator=entityList.iterator();
        while (talentIterator.hasNext()){
            talentMapper.insertTalent(talentIterator.next());
        }
        System.out.println(entityList.toString());
        System.out.println(entityList.iterator().next());
        return false;
    }

    @Override
    public boolean saveOrUpdateBatch(Collection<Talent> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean removeById(Serializable id) {
        return false;
    }

    @Override
    public boolean removeByMap(Map<String, Object> columnMap) {
        return false;
    }

    @Override
    public boolean remove(Wrapper<Talent> queryWrapper) {
        return false;
    }

    @Override
    public boolean removeByIds(Collection<? extends Serializable> idList) {
        return false;
    }

    @Override
    public boolean updateById(Talent entity) {
        return false;
    }

    @Override
    public boolean update(Talent entity, Wrapper<Talent> updateWrapper) {
        return false;
    }

    @Override
    public boolean updateBatchById(Collection<Talent> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdate(Talent entity) {
        return false;
    }

    @Override
    public Talent getById(Serializable id) {
        return null;
    }

    @Override
    public Collection<Talent> listByIds(Collection<? extends Serializable> idList) {
        return null;
    }

    @Override
    public Collection<Talent> listByMap(Map<String, Object> columnMap) {
        return null;
    }

    @Override
    public Talent getOne(Wrapper<Talent> queryWrapper, boolean throwEx) {
        return null;
    }

    @Override
    public Map<String, Object> getMap(Wrapper<Talent> queryWrapper) {
        return null;
    }

    @Override
    public <V> V getObj(Wrapper<Talent> queryWrapper, Function<? super Object, V> mapper) {
        return null;
    }

    @Override
    public int count(Wrapper<Talent> queryWrapper) {
        return 0;
    }

    @Override
    public List<Talent> list(Wrapper<Talent> queryWrapper) {
        List<Talent> list=new ArrayList<>();
        String ids=queryWrapper.getSqlSelect();
         String [] arr=ids.split(",");
        for (int i=0;i<arr.length;i++){
            list.add(talentMapper.selectById(Integer.parseInt(arr[i])));
        }
        return list;
    }

    @Override
    public IPage<Talent> page(IPage<Talent> page, Wrapper<Talent> queryWrapper) {
        return null;
    }

    @Override
    public List<Map<String, Object>> listMaps(Wrapper<Talent> queryWrapper) {
        return null;
    }

    @Override
    public <V> List<V> listObjs(Wrapper<Talent> queryWrapper, Function<? super Object, V> mapper) {
        return null;
    }

    @Override
    public IPage<Map<String, Object>> pageMaps(IPage<Talent> page, Wrapper<Talent> queryWrapper) {
        return null;
    }

    @Override
    public BaseMapper<Talent> getBaseMapper() {
        return null;
    }
}
